import Vue from 'vue'
import App from './App'

import cacheHandler from '@/utils/cacheHandler'
import shareHandler from '@/utils/shareHandler'
import showModalHandler from '@/utils/showModalHandler'
import noData from '@/components/no-data/no-data'
import common from '@/utils/common.js'

import store from './store/index.js'
import themeMixin from './theme/themeMixin.js'
Vue.use(themeMixin)

import messages from './locale/index'
// 获取本地语言配置
const i18nLocale = cacheHandler.getI18nLocale()
let i18nConfig = {
  locale: i18nLocale ? i18nLocale : uni.getLocale(),
  messages
}

import VueI18n from 'vue-i18n'
Vue.use(VueI18n)

Vue.prototype.CACHE = cacheHandler
Vue.prototype.SHARE = shareHandler
Vue.prototype.SHOWMODAL = showModalHandler
Vue.prototype.THROTTLE = common.throttle

Vue.component('noData', noData)

Vue.config.productionTip = false
App.mpType = 'app'
const i18n = new VueI18n(i18nConfig)
const app = new Vue({
  store,
  i18n,
  ...App
})
app.$mount()
